<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <link rel="icon" href="public/favicon.ico" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>axios的尝试</title>
  <script src="https://unpkg.com/vue@3.0.5/dist/vue.global.js"></script>
  <!--axios-->
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
  <div>
    axios...1
  </div>
  <div id="app">
    <hr>
  
    <input type="button" onclick="myGet()" value="ajax-get"/><br><br>
    <input type="button" onclick="myPost()" value="ajax-get"/><br><br>

    <script>
      function myGet() {
        axios.get('/vuex.vue')
        .then(function (response) {
          console.log(response);
        })
        .catch(function (error) {
          console.log(error);
        })
      }
      function myPost() {
        axios({
          method: 'post',
          url: '/json.aspx?id=3',
          data: {
            firstName: 'Fred',
            lastName: 'Flintstone'
          }
        }).then((response) => {
          console.log(response)
          console.log(response.data)
        })

        return 

        axios.post('/vuex.asp', {
          firstName: 'Fred',
          lastName: 'Flintstone'
        })
        .then((response) => {
          console.log(response)
        })
        .catch((error) => {
          console.log(error)
        });
      }
    </script>
</body>
</html>
